package domain;

import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidDataSourceFactory;
import com.alibaba.druid.pool.DruidPooledConnection;
import com.alibaba.druid.stat.JdbcDataSourceStat;

import javax.sql.DataSource;
import java.io.IOException;
import java.sql.Connection;
import java.util.Properties;

public class Test7 {
    public static void main(String[] args) throws Exception {
        Properties pre = new Properties();
        pre.load(Test7.class.getClassLoader().getResourceAsStream("druid.properties"));
        DataSource ds = DruidDataSourceFactory.createDataSource(pre);
        Connection conn = ds.getConnection();
        System.out.println(conn);
        DruidDataSource dd = new DruidDataSource();
        dd.setDriverClassName("com.mysql.jdbc.Driver");
        dd.setUrl("jdbc:mysql://localhost:3306/db2");
        dd.setUsername("root");
        dd.setPassword("root");
        Connection connection = dd.getConnection();
        System.out.println(connection);

    }
}
